﻿<%@ WebHandler Language="C#" Class="AJAXHandler" %>

using System;
using System.Web;
using System.Text;
using ACE.Wireless.PhoneBattery.BLL;
using ACE.Wireless.PhoneBattery.Common;
using ACE.Wireless.PhoneBattery.DataModel;

public class AJAXHandler : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
       string type = context.Request.QueryString["type"];
        context.Response.ContentType = "text/plain";
        context.Response.ContentEncoding = Encoding.UTF8;
        StringBuilder builder = new StringBuilder();
        Type enumType=typeof(Enumerations.UserType);
        builder.Append("[{'id':'','value':'&nbsp;'}");
        foreach (int i in Enum.GetValues(enumType))
        {
            builder.Append(",{");
            builder.Append("'id':");
            builder.Append("'"+Convert.ToString(i)+"',");
            builder.Append("'value':");
            builder.Append("'"+Enum.GetName(enumType,i)+"'");
            builder.Append("}");
        }
        builder.Append("]");
        context.Response.Write(builder.ToString());
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}